package com.topisv.tms.mybatis;

/**
 * 数据库方言枚举
 * @author Fisher
 * @version 1.0.0
 */
public enum DialectType {
    MYSQL("mysql", MysqlDialect.class),
    ORACLE("oracle", OracleDialect.class);
    
    private String databaseId;
    private Class<?> dialectClzz;
    
    DialectType(String databaseId, Class<?> dialectClzz) {
        this.databaseId = databaseId;
        this.dialectClzz = dialectClzz;
    }
    
    public static Class<?> getDialectClzz(String databaseId){
        Class<?> result = null;
        for (DialectType item : DialectType.values()) {
            if(item.getDatabaseId().equalsIgnoreCase(databaseId)){
                result = item.getDialectClzz();
            }
        }
        return result;
    }

    public String getDatabaseId() {
        return databaseId;
    }

    public void setDatabaseId(String databaseId) {
        this.databaseId = databaseId;
    }

    public Class<?> getDialectClzz() {
        return dialectClzz;
    }

    public void setDialectClzz(Class<?> dialectClzz) {
        this.dialectClzz = dialectClzz;
    }
    
}
